const getArrLength = (arr) => {
  if (arr[0] == undefined) {
    return 0;
  } else {
    return 1 + getArrLength(arr.slice(1));
  }
};

let arr = [1, 3, 5, 7, 9];

console.log(getArrLength(arr));
